<template>
  <div class="mcn-application-single-page">
    <!-- 导航栏：保留原风格，增加返回功能 -->
    <el-header class="navbar">
      <div class="container">
        <div class="logo">
          <span class="logo-text">青书</span>
          <span class="logo-sub">qingbook</span>
        </div>
        <div class="nav-menu">
          <el-button 
            class="mcn-btn" 
            :style="{ backgroundColor: primaryColor, color: '#fff' }"
            @click="$router.go(-1)"
          >
            <i class="el-icon-arrow-left"></i> 返回介绍页
          </el-button>
        </div>
      </div>
    </el-header>

    <!-- 主要内容区：聚焦表单，强化引导 -->
    <main class="main-content">
      <section class="application-form-section" :style="{ backgroundColor: primaryColor + '10' }">
        <div class="container">
          <!-- 表单头部引导 -->
          <div class="form-header">
            <h2>青书MCN合作申请</h2>
            <p>填写以下信息，开启你的创作者变现之旅</p>
            <div class="form-tip" :style="{ borderLeftColor: primaryColor }">
              <i class="el-icon-info" :style="{ color: primaryColor }"></i>
              <span>我们将在3个工作日内审核，结果通过你填写的联系方式通知</span>
            </div>
          </div>

          <!-- 核心表单：保留原字段，优化布局与验证 -->
          <el-form 
            class="application-form" 
            :model="form" 
            :rules="formRules" 
            ref="applicationForm"
            label-width="100px"
          >
            <!-- 姓名+联系方式 行 -->
            <el-row :gutter="20" class="form-row">
              <el-col :span="12">
                <el-form-item label="姓名" prop="name">
                  <el-input 
                    v-model="form.name" 
                    placeholder="请输入真实姓名"
                    maxlength="20"
                    show-word-limit
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系方式" prop="phone">
                  <el-input 
                    v-model="form.phone" 
                    placeholder="请输入手机号"
                    type="tel"
                    maxlength="11"
                    show-word-limit
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <!-- 创作领域 行 -->
            <el-row class="form-row">
              <el-col :span="24">
                <el-form-item label="创作领域" prop="field">
                  <el-select 
                    v-model="form.field" 
                    placeholder="请选择你的主要创作领域"
                    clearable
                  >
                    <el-option label="美食" value="food"></el-option>
                    <el-option label="旅行" value="travel"></el-option>
                    <el-option label="时尚" value="fashion"></el-option>
                    <el-option label="美妆" value="beauty"></el-option>
                    <el-option label="科技" value="tech"></el-option>
                    <el-option label="教育" value="education"></el-option>
                    <el-option label="其他" value="other"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>

            <!-- 作品链接 行 -->
            <el-row class="form-row">
              <el-col :span="24">
                <el-form-item label="作品链接" prop="workUrl">
                  <el-input 
                    v-model="form.workUrl" 
                    placeholder="请粘贴你的代表作品链接（如抖音、小红书作品链接）"
                    maxlength="200"
                    show-word-limit
                  ></el-input>
                  <div class="form-hint">
                    <i class="el-icon-lightbulb" :style="{ color: primaryColor }"></i>
                    <span>建议提供3个月内发布的优质作品，有助于提升审核通过率</span>
                  </div>
                </el-form-item>
              </el-col>
            </el-row>

            <!-- 合作意向 行 -->
            <el-row class="form-row">
              <el-col :span="24">
                <el-form-item label="合作意向" prop="intention">
                  <el-input 
                    v-model="form.intention" 
                    type="textarea" 
                    rows="4"
                    placeholder="请说明你的合作需求、期望获得的支持或未来创作规划"
                    maxlength="500"
                    show-word-limit
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <!-- 提交按钮 行 -->
            <el-row class="form-row">
              <el-col :span="24" class="submit-col">
                <el-form-item>
                  <el-button 
                    type="primary" 
                    class="submit-btn" 
                    :style="{ backgroundColor: primaryColor, borderColor: primaryColor }"
                    @click="handleSubmit"
                  >
                    提交合作申请
                  </el-button>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </section>
    </main>

    <!-- 页脚：完全保留原页面样式，确保品牌一致性 -->
    <el-footer class="page-footer">
      <div class="container">
        <div class="footer-content">
          <div class="footer-logo">
            <span class="logo-text">青书</span>
            <span class="logo-sub">qingbook</span>
          </div>
          
          <div class="footer-contact">
            <div class="social-links">
              <a href="#" :style="{ color: primaryColor }"><i class="el-icon-weibo"></i></a>
              <a href="#" :style="{ color: primaryColor }"><i class="el-icon-wechat"></i></a>
              <a href="#" :style="{ color: primaryColor }"><i class="el-icon-qq"></i></a>
            </div>
          </div>
          
          <div class="contact-info">
            <p>客服电话：400-123-4567</p>
            <p>工作时间：周一至周五 9:00-18:00</p>
          </div>
        </div>
        
        <div class="copyright-container">
          <p class="copyright-text">© 2023 青书(qingbook) 版权所有</p>
        </div>
      </div>
    </el-footer>

    <!-- 提交成功弹窗 -->
    <el-dialog
      title="申请提交成功"
      :visible.sync="successDialogVisible"
      width="380px"
      :close-on-click-modal="false"
      :show-close="false"
    >
      <div class="dialog-inner">
        <div class="success-icon" :style="{ color: primaryColor }">
          <i class="el-icon-check-circle"></i>
        </div>
        <p class="success-title">你的合作申请已提交</p>
        <p class="success-desc">我们将在3个工作日内完成审核，结果将通过短信通知你</p>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button 
          :style="{ backgroundColor: primaryColor, color: '#fff' }"
          @click="successDialogVisible = false"
        >
          确认
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'McnApplicationSingle',
  data() {
    return {
      primaryColor: '#00B4AC', // 完全继承原页面主色调
      form: {
        name: '',    // 姓名
        phone: '',   // 联系方式
        field: '',   // 创作领域
        workUrl: '', // 作品链接
        intention: ''// 合作意向
      },
      // 表单验证规则：确保数据有效性
      formRules: {
        name: [
          { required: true, message: '请输入姓名', trigger: 'blur' },
          { min: 2, max: 20, message: '姓名长度需在2-20个字符之间', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '请输入手机号', trigger: 'blur' },
          { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号格式', trigger: 'blur' }
        ],
        field: [
          { required: true, message: '请选择创作领域', trigger: 'change' }
        ],
        workUrl: [
          { required: true, message: '请输入作品链接', trigger: 'blur' },
          { pattern: /^(https?:\/\/)/, message: '链接需以http或https开头', trigger: 'blur' }
        ],
        intention: [
          { required: true, message: '请填写合作意向', trigger: 'blur' },
          { min: 20, message: '合作意向至少20个字符', trigger: 'blur' }
        ]
      },
      successDialogVisible: false // 提交成功弹窗控制
    }
  },
  mounted() {
    console.log('青书MCN申请表单页面初始化');
  },
  methods: {
    // 表单提交处理
    handleSubmit() {
      this.$refs.applicationForm.validate((isValid) => {
        if (isValid) {
          // 此处可添加接口请求逻辑（如提交表单数据到后端）
          console.log('表单提交数据：', this.form);
          // 显示提交成功弹窗
          this.successDialogVisible = true;
          // 重置表单
          this.$refs.applicationForm.resetFields();
        }
      });
    }
  }
}
</script>

<style scoped>
/* 全局基础样式：继承原页面 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 导航栏样式：与原页面一致 */
.navbar {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 12px 0 !important;
  position: relative;
  z-index: 1000;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  height: 40px;
}

.logo-text {
  color: v-bind(primaryColor);
  margin-right: 5px;
}

.logo-sub {
  font-size: 14px;
  color: #666;
  margin-top: 5px;
}

.nav-menu {
  display: flex;
  align-items: center;
  height: 40px;
}

.mcn-btn {
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  height: 100%;
}

/* 主要内容区样式 */
.main-content {
  background-color: #f9f9f9;
  padding: 60px 0;
}

/* 表单区样式 */
.application-form-section {
  padding: 40px 0;
  margin: 0 auto;
  max-width: 900px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.form-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 0 20px;
}

.form-header h2 {
  font-size: 28px;
  color: #333;
  margin-bottom: 12px;
}

.form-header p {
  font-size: 16px;
  color: #666;
  margin-bottom: 16px;
}

.form-tip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: #fff;
  border-left: 3px solid;
  border-radius: 4px;
  color: #666;
  font-size: 14px;
}

/* 表单内部样式 */
.application-form {
  background-color: #fff;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-row {
  margin-bottom: 20px;
}

.form-hint {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #888;
}

.submit-col {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.submit-btn {
  width: 220px;
  padding: 12px 0;
  font-size: 16px;
  border-radius: 24px;
}

/* 提交成功弹窗样式 */
.dialog-inner {
  text-align: center;
  padding: 10px 0 20px;
}

.success-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.success-title {
  font-size: 18px;
  color: #333;
  margin-bottom: 8px;
}

.success-desc {
  font-size: 14px;
  color: #666;
}

.dialog-footer {
  display: flex;
  justify-content: center;
  padding: 10px 0 0;
}

/* 页脚样式：完全继承原页面 */
.page-footer {
  background-color: #333;
  color: #fff;
  padding: 40px 0;
  position: relative;
  width: 100%;
  height: auto;
  z-index: 10;
}

.page-footer .container {
  display: block;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.footer-logo,
.footer-contact,
.contact-info {
  display: flex;
  align-items: center;
}

.footer-logo .logo-text {
  color: #fff;
  font-size: 24px;
  margin-right: 5px;
}

.footer-logo .logo-sub {
  color: #aaa;
  font-size: 14px;
  margin-top: 5px;
}

.social-links {
  display: flex;
  gap: 15px;
}

.social-links a {
  font-size: 20px;
  transition: all 0.3s ease;
}

.contact-info {
  color: #aaa;
  flex-direction: column;
  align-items: flex-start;
}

.contact-info p {
  margin: 5px 0;
  white-space: nowrap;
}

.copyright-container {
  display: flex;
  justify-content: center;
  padding-top: 20px;
  border-top: 1px solid #444;
}

.copyright-text {
  color: #aaa;
  font-size: 14px;
  text-align: center;
}

/* 响应式适配：继承原页面逻辑 */
@media (max-width: 768px) {
  .application-form-section {
    padding: 30px 0;
    margin: 0 15px;
  }

  .form-header h2 {
    font-size: 24px;
  }

  .el-row .el-col {
    width: 100% !important;
  }

  .submit-btn {
    width: 100%;
  }

  .footer-content {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .contact-info {
    align-items: center;
  }
}

@media (max-width: 576px) {
  .logo {
    font-size: 20px;
  }

  .mcn-btn {
    font-size: 14px;
    padding: 6px 16px;
  }

  .application-form {
    padding: 20px 15px;
  }

  .el-form-item {
    margin-bottom: 16px;
  }
}
</style>